//
// Created by wenyaxi on 24-10-28.
//
#include "Printer.h"

namespace printer {
    std::string int_array_to_string(const std::vector<int> &arr) {
        if (arr.empty()) {
            return "{[]}";
        }
        std::stringstream ss;
        ss << "{[";
        for (int i = 0; i < arr.size(); i++) {
            if (i != arr.size() - 1)
                ss << arr[i] << ",";
            else
                ss << arr[i] << "]}";
        }
        return ss.str();
    }

    template<typename T>
    std::string array_to_string(const std::vector<T> &arr) {
        std::stringstream ss;
        if (arr.empty()) {
            return "{}";
        }
        ss<<"{";
        for (int i = 0; i < arr.size(); i++) {
            if (i != arr.size() - 1)
                ss << arr[i] << ",";
            else
                ss << arr[i] << "}";
        }
        return ss.str();
    }
}
